package com.huiminpay.transaction.mq;

import com.huiminpay.transaction.api.dto.PayOrderDTO;
import com.huiminpay.transaction.api.dto.PayOrderMqDTO;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Component;

/**
 * @ClassName : PayProducter
 * @Author : 阿泽
 * @Date: 2021/8/18 13:56
 * @Description :
 */
@Component
public class PayProducter {
    @Autowired
    RocketMQTemplate rocketMQTemplate;


    public void sendMsgByDelay(String topic, PayOrderMqDTO payOrderMqDTO){
        Message<PayOrderMqDTO> message = MessageBuilder.withPayload(payOrderMqDTO).build();
        this.rocketMQTemplate.syncSend(topic,message,1000,3);

    }
}
